#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
  int minDeletions(string s)
  {
    int cnt[26]{};
    for (char c : s)
      cnt[c - 'a'] += 1;
    unordered_map<int, int> um;
    int ans = 0;
    for (int i = 0; i < 26; i++)
    {
      if (cnt[i] != 0)
      {
        while (um[cnt[i]])
        {
          cnt[i] -= 1;
          ans += 1;
        }
        if (cnt[i] != 0)
          um[cnt[i]] += 1;
      }
    }
    return ans;
  }
};
int main()
{
  Solution s;

  return 0;
}
